<template>
	<!-- 2.0.19支持autoBack，默认为false -->
	<u-navbar
		title=""
		leftIconColor="#fff"
		leftColor="#fff"
		:leftText="headerName"
		@rightClick="rightClick"
		@leftClick="leftClick"
		:autoBack="false"
		:placeholder="true"
		bgColor="#005495"
	>
		<view
			slot="right"
		>
			<u-icon
			color="#fff"
				name="home"
				size="24"
			></u-icon>
			
		</view>
	</u-navbar>
</template>

<script>
	export default{
		props:{
			headerName:{
				//按钮字体颜色
				type: String,
				default: "",
			},
		},
		computed:{

		},
		methods: {
			rightClick(){
				// this.appUtil.logout()
				let paramsString = "/pages/menu/index"
				uni.navigateTo({
					url: paramsString,
				})
			},
			leftClick(){
				var pages = getCurrentPages();
				var prePage = pages[pages.length - 2] //上一个页面
				//调用上一页拉取数据的方法
				console.log(prePage)
				if (prePage.route == "pages/menu/index") {
					prePage.$vm.fetchData()
				}
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped>

</style>